<template>
    <div class="login_background" v-show="show" :style="moveStyle">
        <div class="login_box">
            <div class="login">              
                <div class="login_form">
                    <span>用户名：</span>
                    <input type="text" placeholder="请输入账号" v-model.trim="username">
                    <span>密码：</span>
                    <input type="password" placeholder="请输入密码" v-model.trim="password">
                </div>
                <div class="btn">
                    <button class="login_btn" @click.prevent="submit">登录</button>
                </div>
            </div>
        </div>
    </div>
</template>

<script>

export default {
    // name:'Login',
    data() {
        return {
            show: true,
            moveStyle: {}
        }
    },
    methods: {
        submit: function () {
            if (1) {
                this.$router.replace('/home');
            } else if (this.username === '') {
                alert('用户不能为空');
                localStorage.removeItem('token')
            } else if (this.password === '') {
                alert('密码不能为空');
                localStorage.removeItem('token')
            }
        },

    }
}

</script>

<style scoped>
.login_background {
    background-color: #ffffff;
    border-radius: 7px;
    width: 320px;
    height: 500px;
    position: fixed;
    margin-top: -60px;
    box-shadow: 2px 0 10px rgba(120, 149, 53, 0.1);
    transition: all 0.5s;
}

.login_form {
    padding: 20px;
    /* color: white; */

}

.login_box {
    padding: 72px 0px;
}

.login_btn:hover {
    background-color: transparent;
    color: rgb(255, 255, 255);
    background-color: black;
    /* 选择动画 */
    animation: login_mation 0.5s;
}

.login_btn {
    background-color: rgb(255, 255, 255, 255);
    border: 1px solid rgb(0, 0, 0);
    padding: 10px;
    width: 150px;
    height: 60px;
    border-radius: 30px;
    font-size: 20px;
    color: rgb(22, 31, 39);
    font-weight: 100;
    margin-top: 15px;
    margin-left: 75px;
}

.login_form input {
    background-color: transparent;
    width: 250px;
    padding: 2px;
    text-indent: 2px;
    color: black;
    font-size: 20px;
    height: 45px;
    margin: 30px 30px 30px 5px;
    outline: none;
    border: 0;
    border-bottom: 1px solid rgb(36, 42, 45);
}

.login_form span {
    color: rgb(165, 207, 85);
    font-size: 20px;
    font-weight: 400;
}
</style>